<?php
/**
 * Created by PhpStorm.
 * User: giozola
 * Date: 2018/6/7
 * Time: 12:23
 */

namespace addons\hlapp\dto;


class PageInfo
{
    public $pageIndex;
    public $pageSize;
    public $pageMaxSize;
    public $pageList;
    public $count;
    public $pageCount;

    function __construct($pageIndex,$pageSize,$pageList,$count){
        $this->pageMaxSize = $pageSize;
        $this->pageIndex = $pageIndex;
        if($pageSize*$pageIndex > $count){
            $this->pageSize = $count%$pageSize;
        }else{
            $this->pageSize = $pageSize;
        }
        $this->pageList = $pageList;
        $this->count = $count;
        $this->pageCount = ceil($count/$pageSize);
    }

    static public function setPage($pageIndex,$pageSize,$pageList,$count){
        return new PageInfo($pageIndex,$pageSize,$pageList,$count);
    }

}